#!/bin/bash

if [ $# -lt 1 ]
then
echo "usage: ./gen-moos-app <project-name>" 
exit 
fi

cp -r ./moos-app-template ./$@

pushd ./$@ > /dev/null

mv ./TemplateApp.cpp.tpl ./$@App.cpp 
mv ./TemplateApp.h.tpl ./$@App.h 
mv ./main.cpp.tpl ./main.cpp 

find . -type f -exec sed -i "s/(>>>PROJECT-NAME<<<)/$@/g" {} \;

popd > /dev/null

echo "Generated project: $@"
